/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * pantallaVerTallerCapacitacion.java
 *
 * Created on 17-ago-2010, 16:44:42
 */

package vista.rrhh;

import controlador.rrhh.GestorVerTallerCapacitacion;
import java.util.ArrayList;
import java.util.Iterator;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import util.NTupla;

/**
 *
 * @author Administrador
 */
public class pantallaVerTallerCapacitacion extends javax.swing.JInternalFrame {

    private GestorVerTallerCapacitacion gestor;
    private int ID_TALLER = 0;

    /** Creates new form pantallaVerTallerCapacitacion */
    public pantallaVerTallerCapacitacion(int id) {
        initComponents();

        this.ID_TALLER = id;
        this.gestor = new GestorVerTallerCapacitacion(this);

        this.gestor.cargarDatosTaller(this.ID_TALLER);

    }

    public void setDatosGenerales(String txt, String descripcion, String capacitador)
    {
        lbl_Tipo.setText(txt);
        lbl_capacitador.setText(capacitador);
        lbl_desc.setText(descripcion);
    }


   /**
     * EL-0017 : No se pudo cargar el Taller
     * @param cod
     */
    public void MostrarMensaje(String cod)
    {
        System.out.println("Se detecto el mensaje: "+cod);
        if(cod.equals("EG-0016"))
        {
            JOptionPane.showMessageDialog(this.getParent(),"No se pudo cargar el Taller de Capacitación","Error en la Carga",JOptionPane.ERROR_MESSAGE);
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton1 = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        tblHorarios = new javax.swing.JTable();
        lblDescripcion = new javax.swing.JLabel();
        lblTipoCapacitacion = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        lblNombreLugarCapacitacion = new javax.swing.JLabel();
        lblDieccionLugar = new javax.swing.JLabel();
        lbl_nombreLugar = new javax.swing.JLabel();
        lbl_direLugar = new javax.swing.JLabel();
        lblNombreCapacitador = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblEmpleados = new javax.swing.JTable();
        lbl_Tipo = new javax.swing.JLabel();
        lbl_desc = new javax.swing.JLabel();
        lbl_capacitador = new javax.swing.JLabel();

        jButton1.setText("jButton1");

        setClosable(true);
        setIconifiable(true);
        setTitle("Taller de Capacitación");

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos del Taller"));

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Horarios del Taller"));

        tblHorarios.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Fecha", "Hora de Inicio", "Hora de Fin"
            }
        ));
        jScrollPane3.setViewportView(tblHorarios);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 608, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE)
                .addContainerGap())
        );

        lblDescripcion.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lblDescripcion.setText("Descripción:");

        lblTipoCapacitacion.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lblTipoCapacitacion.setText("Tipo de Capacitación:");

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Lugar de la Capacitación"));

        lblNombreLugarCapacitacion.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lblNombreLugarCapacitacion.setText("Nombre:");

        lblDieccionLugar.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lblDieccionLugar.setText("Dirección:");

        lbl_nombreLugar.setText("jLabel1");

        lbl_direLugar.setText("jLabel2");

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(lblDieccionLugar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(lblNombreLugarCapacitacion, javax.swing.GroupLayout.DEFAULT_SIZE, 74, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl_nombreLugar, javax.swing.GroupLayout.DEFAULT_SIZE, 508, Short.MAX_VALUE)
                    .addComponent(lbl_direLugar, javax.swing.GroupLayout.DEFAULT_SIZE, 508, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbl_nombreLugar)
                    .addComponent(lblNombreLugarCapacitacion))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblDieccionLugar)
                    .addComponent(lbl_direLugar))
                .addContainerGap())
        );

        lblNombreCapacitador.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lblNombreCapacitador.setText("Nombre del Capacitador: ");

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Empleados que asistirán"));

        tblEmpleados.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Legajo", "Apellido", "Nombre"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jScrollPane1.setViewportView(tblEmpleados);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 588, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE)
                .addContainerGap())
        );

        lbl_Tipo.setText("jLabel6");

        lbl_desc.setText("jLabel7");

        lbl_capacitador.setText("jLabel8");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblNombreCapacitador, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblTipoCapacitacion, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblDescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lbl_Tipo, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 463, Short.MAX_VALUE)
                            .addComponent(lbl_desc, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 463, Short.MAX_VALUE)
                            .addComponent(lbl_capacitador, javax.swing.GroupLayout.DEFAULT_SIZE, 463, Short.MAX_VALUE))))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblTipoCapacitacion)
                    .addComponent(lbl_Tipo))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl_desc, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(lblDescripcion))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNombreCapacitador)
                    .addComponent(lbl_capacitador))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 684, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addContainerGap()))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 649, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(13, Short.MAX_VALUE)))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JLabel lblDescripcion;
    private javax.swing.JLabel lblDieccionLugar;
    private javax.swing.JLabel lblNombreCapacitador;
    private javax.swing.JLabel lblNombreLugarCapacitacion;
    private javax.swing.JLabel lblTipoCapacitacion;
    private javax.swing.JLabel lbl_Tipo;
    private javax.swing.JLabel lbl_capacitador;
    private javax.swing.JLabel lbl_desc;
    private javax.swing.JLabel lbl_direLugar;
    private javax.swing.JLabel lbl_nombreLugar;
    private javax.swing.JTable tblEmpleados;
    private javax.swing.JTable tblHorarios;
    // End of variables declaration//GEN-END:variables

    public void setHorarios(ArrayList<NTupla> lista)
    {
        Iterator<NTupla> it = lista.iterator();

        DefaultTableModel modelo = (DefaultTableModel)tblHorarios.getModel();

        while (it.hasNext())
        {
            NTupla nt = it.next();
            Object[] fila = new Object[3];
            fila[0] = nt;

                String[] horas = (String[])nt.getData();
                fila[1] = horas[0];
                fila[2] = horas[1];
                
            modelo.addRow(fila);
        }
    }

    public void setLugar(String nombre, String direccion)
    {
        this.lbl_nombreLugar.setText(nombre);
        this.lbl_direLugar.setText(direccion);
    }

    public void setEmpleados(ArrayList<NTupla> listaEmpleado) {

        DefaultTableModel modelo = (DefaultTableModel)tblEmpleados.getModel();
        Iterator it = listaEmpleado.iterator();
        while (it.hasNext())
        {
            Object[] fila = new Object[3];
            NTupla nt = (NTupla)it.next();
            fila[0] = nt;
                String[] dato = (String[]) nt.getData();
                fila[1] = dato[0];
                fila[2] = dato[1];
            modelo.addRow(fila);
        }

    }

}
